home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
FORTH
/
FORTHMAC
/
OLD
/
TOOLS1
/
!Forthmacs.lib.block2file
< prev
next >
Wrap
Text File
|
1996-06-15
|
1KB
|
35 lines
\ btof.fth
\ Convert from block files to stream files.
\
\ Block files contain a sequence of records each with 64
\ upper case characters.
\
\ Stream files contain variable-length lines terminated
\ by a newline character, without trailing blanks. Characters
\ are lower case.
\
\ btof \ block-file stream-file ( -- )
\ Convert block file to stream file
\
\ If your block files contain anything interesting in block 0,
\ comment-out the
\ " pad d# 1024 ifd @ fgets drop " line in btof.
: fcr ( fd -- )
newline-string rot fputs ;
: 1line-b-f ( -- end? ) \ True when end of input file
pad d# 64 ifd @ fgets ( #gotten) \ Grab a record
?dup
if pad swap -trailing ( addr len) \ Strip trailing blanks
2dup lower ( addr len) \ Change to lower case
ofd @ fputs ( ) \ Write to output file
ofd @ fcr
false
else true
then ;
: btof \ in-file-name out-file-name ( -- )
reading writing
pad d# 1024 ifd @ fgets drop \ omit if block 0 is interesting
begin 1line-b-f until
ifd @ close ofd @ close ;